using System;
using System.Collections.Generic;
using System.Text;
using FactoryPattern.Domain;
using FactoryPattern.Factories;

namespace FactoryPattern
{
    class Program
    {
        static void Main(string[] args)

        {

            //LogicalFactoryExample();
            //Console.WriteLine("\r\n\r\n");

            ReflectedFactoryExample();
            Console.WriteLine("\r\n\r\n");

            //InheritedFactoryExample();
            Console.ReadLine();
        }

        static void LogicalFactoryExample()
        {
            Suit armani = SuitFactoryLogical.CreateSuit(SuitType.Armani);


            Suit jogging = SuitFactoryLogical.CreateSuit(SuitType.JoggingSuit);
            //Suit solidBusiness = SuitFactoryLogical.CreateSuit(SuitType.SolidBusinessSuit);

            Console.WriteLine("Suits Created From Logical Factory Example : \r\n" + armani.Name +
                "\r\n" + jogging.Name + "\r\n");
        }

        private static void ReflectedFactoryExample()
        {
            SuitFactoryReflected factory = new SuitFactoryReflected();

            //you only register what you need for a particular workItem.
            //factory.Register(SuitType.Armani, typeof(Armani));
            //factory.Register(SuitType.GolfSuit, typeof(GolfSuit));
            //factory.Register(SuitType.MotorcycleSuit, typeof(MotorcycleSuit));

            Suit armani = factory.CreateSuit(SuitType.Armani);
            armani.Name = "Some name i added";
            Suit golfSuit = factory.CreateSuit(SuitType.GolfSuit);
            Suit motorCycle = factory.CreateSuit(SuitType.MotorcycleSuit);
            Suit armanibetter = factory.CreateSuit(SuitType.Armani);

            Console.WriteLine("Suits Created From Reflected Factory Example : \r\n" + armani.Name +
               "\r\n" + golfSuit.Name + "\r\n" + motorCycle.Name + "\r\n" + armanibetter.Name);
        }

        private static void InheritedFactoryExample()
        {
            SuitFactoryInheritance lSuitFactory = new LeisureSuitFactory();
            SuitFactoryInheritance bSuitFactory = new BusinessSuitFactory();

            Suit armani = bSuitFactory.GetSuit(SuitType.Armani);
            Suit plain = bSuitFactory.GetSuit(SuitType.PlaidBusinessSuit);
            Suit golf = lSuitFactory.GetSuit(SuitType.GolfSuit);

            Console.WriteLine("Suits Created From Reflected Factory Example : \r\n" + armani.Name +
               "\r\n" + plain.Name + "\r\n" + golf.Name);
        }
    }
}
